#ifndef POINT_H
#define POINT_H

#include <QWidget>

#include "geometry.h"

class Point : public Geometry
{
    Q_OBJECT

public:
    friend class Layer;
    friend class LineString;

    enum Alignment
    {
        TopLeft, /*!< Align on TopLeft*/
        TopRight, /*!< Align on TopRight*/
        BottomLeft, /*!< Align on BottomLeft*/
        BottomRight,/*!< Align on BottomRight*/
        Middle /*!< Align on Middle*/
    };

    Point();
    explicit Point(const Point&);


    Point(qreal x, qreal y, QString name = QString(), enum Alignment alignment=Middle);

    Point(qreal x, qreal y, QWidget* widget, QString name = QString(), enum Alignment alignment = Middle);

    Point(qreal x, qreal y, QPixmap* pixmap, QString name = QString(), enum Alignment alignment = Middle);
    virtual ~Point();

    virtual QRectF boundingBox();

    qreal longitude() const;

    qreal latitude() const;

    QPointF coordinate() const;

    virtual QList<Point*> points();

    QWidget* widget();

    QPixmap* pixmap();

    void setBaselevel(int zoomlevel);

    void setMinsize(QSize minsize);

    void setMaxsize(QSize maxsize);

    Point::Alignment alignment() const;

protected:
    qreal X;
    qreal Y;
    QSize size;

    QWidget* mywidget;
    QPixmap* mypixmap;
    Alignment myalignment;
    int homelevel;
    QSize displaysize;
    QSize minsize;
    QSize maxsize;


    void drawWidget(const MapAdapter* mapadapter, const QPoint offset);
    // void drawPixmap(QPainter* painter, const MapAdapter* mapadapter, const QRect &viewport, const QPoint versch);
    virtual void draw(QPainter* painter, const MapAdapter* mapadapter, const QRect &viewport, const QPoint offset);
    QPoint alignedPoint(const QPoint point) const;

    virtual bool Touches(Point* geom, const MapAdapter* mapadapter);

public slots:
    void setCoordinate(QPointF point);
    virtual void setVisible(bool visible);
};
#endif
